﻿Imports TauxGaranti.ViewModels

Namespace ViewModels
    Public Class Locator
#Region "Modèle"
        Private Shared _model As Model
        Private ReadOnly Property Model() As Model
            Get
                Return ModelStatic
            End Get
        End Property
        Private Shared ReadOnly Property ModelStatic() As Model
            Get
                If _model Is Nothing Then _model = New Model
                Return _model
            End Get
        End Property
#End Region

#Region "ViewModelMainWindow property"
        Private Shared _viewModelMainWindow As ViewModelMainWindow
        Public ReadOnly Property ViewModeleMainWindow() As ViewModelMainWindow
            Get
                Return ViewModeleMainWindowStatic
            End Get
        End Property
        Public Shared ReadOnly Property ViewModeleMainWindowStatic() As ViewModelMainWindow
            Get
                If _viewModelMainWindow Is Nothing Then
                    If Application.IsInDesignMode() Then MsgBox("Test")
                    createViewModeleMainWindow()
                End If
                Return _viewModelMainWindow
            End Get
        End Property
        Private Shared Sub createViewModeleMainWindow()
            _viewModelMainWindow = New ViewModelMainWindow(ModelStatic)
        End Sub
#End Region

#Region "ViewModelCmdEncoursCorresp property"
        Private Shared _viewModelCmdEncoursCorresp As ViewModelCmdEncoursCorresp
        Public Shared ReadOnly Property ViewModelCmdEncoursCorrespStatic() As ViewModelCmdEncoursCorresp
            Get
                If _viewModelCmdEncoursCorresp Is Nothing Then
                    createViewModelEncoursCorresp()
                End If
                Return _viewModelCmdEncoursCorresp
            End Get
        End Property
        Public ReadOnly Property ViewModelCmdEncoursCorresp() As ViewModelCmdEncoursCorresp
            Get
                Return ViewModelCmdEncoursCorrespStatic
            End Get
        End Property
        Private Shared Sub createViewModelEncoursCorresp()
            'Récupération du ViewModelCmdEncoursCorresp dans le Main
            _viewModelCmdEncoursCorresp = ViewModeleMainWindowStatic.ViewModelCmdEncoursCorresp
        End Sub
#End Region

#Region "ViewModelCmdEncoursImport property"
        Private Shared _viewModelCmdEncoursImport As ViewModelCmdEncoursImport
        Public Shared ReadOnly Property ViewModelCmdEncoursImportStatic() As ViewModelCmdEncoursImport
            Get
                If _viewModelCmdEncoursImport Is Nothing Then
                    createViewModelEncoursImport()
                End If
                Return _viewModelCmdEncoursImport
            End Get
        End Property
        Public ReadOnly Property ViewModelCmdEncoursImport() As ViewModelCmdEncoursImport
            Get
                Return ViewModelCmdEncoursImportStatic
            End Get
        End Property
        Private Shared Sub createViewModelEncoursImport()
            'Récupération du ViewModelCmdEncoursCorresp dans le Main
            _viewModelCmdEncoursImport = ViewModeleMainWindowStatic.ViewModelCmdEncoursImport
        End Sub
#End Region
    End Class
End Namespace